package com.xca.znb.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import androidx.annotation.Nullable;

public class FootDBHelper extends SQLiteOpenHelper {
    private static final String DATABASE_NAME = "foot.db" ;
    private static final int DATABASE_VERSION = 1 ;
    public static final String TABLE_FOOT = "foot" ;
    public static final String FOOT_ID = "id" ;
    public static final String FOOT_GOODS = "goodsId" ;
    public static final String FOOT_USER = "user" ;
    public static final String FOOT_TIME = "time" ;

    private static final String CREATE_TABLE_FOOT = "CREATE TABLE " + TABLE_FOOT + " ( " +
            FOOT_ID + " INTEGER PRIMARY KEY AUTOINCREMENT , " +
            FOOT_GOODS + " INT , " +
            FOOT_USER + " TEXT , " +
            FOOT_TIME + " TEXT )";
    public FootDBHelper(@Nullable Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_TABLE_FOOT);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL("DROP TABLE IF EXISTS " + TABLE_FOOT);
        onCreate(db);
    }
}
